#!/bin/bash

# adding this script to crontab example:
#  0 0 * * * cd /root/auto-reaver && /bin/sh ./reaverDirectoryBackup

# script gets reaver session directory from its settings
source $(pwd)/configurationSettings
BACKUPDIR=$(pwd)/reaverBackup
if [ ! -d $BACKUPDIR ]; then
  mkdir -p -m 700 "$BACKUPDIR"
fi
FILENAME=reaverBackup_`date +"%Y-%m-%d_%H-%M-%S"`.tar.gz
FILEPATH="$BACKUPDIR"/"$FILENAME"
tar -czvf $FILEPATH $REAVER_SESSION_DIR

# List contents of tar.gz file
# tar -ztvf file.tar.gz
echo ">>> Listing contents of created backup $FILEPATH : "
tar -ztvf $FILEPATH
